package com.fs.mapper;

import com.fs.entity.OrderItem;
import org.apache.ibatis.annotations.*;


import java.util.List;

@Mapper
public interface OrderItemMapper {

    @Insert("INSERT INTO order_items (order_id, product_id, product_name, product_image, price, quantity, subtotal, create_time) " +
            "VALUES (#{orderId}, #{productId}, #{productName}, #{productImage}, #{price}, #{quantity}, #{subtotal}, #{createTime})")
    int insert(OrderItem orderItem);

    @Select("SELECT * FROM order_items WHERE order_id = #{orderId}")
    List<OrderItem> selectByOrderId(Long orderId);
}
